package com.eos.control.action.activity;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.eos.business.service.SysActivityBusinessService;
import com.eos.control.action.base.AbstractBaseAction;
import com.eos.orm.mybatis.model.SysActivtySon;
import com.hf.utils.PaginationBean;

public class SonActivityListAction extends AbstractBaseAction {
	private static final long serialVersionUID = 4583489340567635786L;
	private String activtySonName;
	private String activtyId;
	private String dealFlag;
	private Integer pageNum;
	private Integer numPerPage;
	private Integer totalCount;
	private List<SysActivtySon> activtySonList;


	public void setActivtySonName(String activtySonName) {
		this.activtySonName = activtySonName;
	}

	public String getActivtySonName() {
		return activtySonName;
	}

	public String getActivtyId() {
		return activtyId;
	}

	public void setActivtyId(String activtyId) {
		this.activtyId = activtyId;
	}

	public String getDealFlag() {
		return dealFlag;
	}

	public void setDealFlag(String dealFlag) {
		this.dealFlag = dealFlag;
	}

	public Integer getPageNum() {
		return pageNum;
	}

	public void setPageNum(Integer pageNum) {
		this.pageNum = pageNum;
	}

	public Integer getNumPerPage() {
		return numPerPage;
	}

	public void setNumPerPage(Integer numPerPage) {
		this.numPerPage = numPerPage;
	}

	public Integer getTotalCount() {
		return totalCount;
	}

	public List<SysActivtySon> getActivtySonList() {
		return activtySonList;
	}

	@SuppressWarnings("unchecked")
	@Override
	public String execute() {
		try {
			if (pageNum == null || pageNum.intValue() == 0)
				pageNum = 1;
			if (numPerPage == null || numPerPage.intValue() == 0)
				numPerPage = PAGE_SIZE;
			SysActivityBusinessService sabs = new SysActivityBusinessService();
			Map<String, String> map = new HashMap<String, String>();
			map.put("activty_son_name", activtySonName);
			map.put("page_size", numPerPage + "");
			map.put("cur_page", pageNum + "");
			map.put("deal_flag", dealFlag);
			map.put("activty_id", activtyId);
			map.put("table_name", "sys_activty_son");
			PaginationBean pageBean = sabs.getSonActivityList(map);
			totalCount = null != pageBean ? pageBean.getMaxcount() : 0;
			activtySonList = null != pageBean ? (List<SysActivtySon>) pageBean.getResultList() : null;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return SUCCESS;
	}
}
